<?php
class LoginController extends Zendvn_Controller_Action{
	
	private $_arrParams;
	
	public function init(){
		$this->view->arrParam = $this->_request->getParams();
		$this->_arrParams = $this->_request->getParams();
	}
	
	public function indexAction(){
		$info = new Zendvn_System_Info();
	}
	
	public function loginAction(){
		$ss = new Zend_Session_Namespace(APPLICATION_KEY);
		if($this->_request->isPost()){			
			$auth = new Zendvn_System_Auth();
			$auth->login($this->_arrParams);
			if(!$auth->login($this->_arrParams)){
				$message = $auth->getMessages(); // Lay thong tin loi
				$this->_redirect('default/index/index/login_error/1');
			}else {
				$info = new Zendvn_System_Info();
				$auth = Zend_Auth::getInstance();			
				$info->setInfo($auth);
				$this->_redirect('default/index/index');
			}
		}
		$this->_helper->viewRenderer->setNoRender();
	}
	
	public function logoutAction(){
		$auth = new Zendvn_System_Auth();
		$auth->logout();
		$info = new Zendvn_System_Info();
		$info->clearInfo();
		$this->_redirect('default/index/index');
	}
	
	public function noAccessAction(){
		
	}
}